<?php
/**
 * Magento Enterprise Edition
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Magento Enterprise Edition End User License Agreement
 * that is bundled with this package in the file LICENSE_EE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.magento.com/license/enterprise-edition
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     enterprise_default
 * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
 * @license http://www.magento.com/license/enterprise-edition
 */
?>
<div class="page-title">
    <h1><?php echo $this->__('Edit Account Information') ?></h1>
</div>
<?php echo $this->getMessagesBlock()->toHtml() ?>
<form action="<?php echo $this->getUrl('customer/account/editPost') ?>" method="post" autocomplete="off" id="form-validate" enctype="multipart/form-data">
<div class="fieldset">
    <?php echo $this->getBlockHtml('formkey')?>
    <h2 class="legend"><?php echo $this->__('Account Information') ?></h2>
    <ul class="form-list">
        <li class="fields">
            <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getCustomer())->toHtml() ?>
        </li>
        <li>
            <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
            <div class="input-box">
                <input type="text" name="email" id="email" value="<?php echo $this->escapeHtml($this->getCustomer()->getEmail()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Email Address')) ?>" class="input-text required-entry validate-email" />
            </div>
        </li>
        <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
        <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
        <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
        <?php if($_dob->isEnabled() || $_taxvat->isEnabled() || $_gender->isEnabled()): ?>
        <li class="fields">
            <?php if ($_dob->isEnabled()): ?>
            <div class="field"><?php echo $_dob->setDate($this->getCustomer()->getDob())->toHtml() ?></div>
            <?php endif ?>
            <?php if ($_taxvat->isEnabled()): ?>
            <div class="field"><?php echo $_taxvat->setTaxvat($this->getCustomer()->getTaxvat())->toHtml() ?></div>
            <?php endif ?>
            <?php if ($_gender->isEnabled()): ?>
            <div class="field"><?php echo $_gender->setGender($this->getCustomer()->getGender())->toHtml() ?></div>
            <?php endif ?>
        </li>
        <?php endif ?>
        <li class="control">
            <div class="input-box">
                <input type="checkbox" name="change_password" id="change_password" value="1" onclick="setPasswordForm(this.checked)" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Change Password')) ?>"<?php if($this->getCustomer()->getChangePassword()==1): ?> checked="checked"<?php endif; ?> class="checkbox" />
            </div>
            <label for="change_password"><?php echo $this->__('Change Password') ?></label>
        </li>
    </ul>
</div>
<?php $userDefinedAttributes = $this->getLayout()->getBlock('customer_form_user_attributes'); ?>
<?php if ($userDefinedAttributes):?>
    <?php echo $userDefinedAttributes->setEntity($this->getCustomer())->toHtml(); ?>
<?php endif;?>
<div class="fieldset" style="display:none;">
    <h2 class="legend"><?php echo $this->__('Change Password') ?></h2>
    <ul class="form-list">
        <li class="fields">
            <div class="field">
                <label for="current_password"><?php echo $this->__('Current Password') ?></label>
                <div class="input-box">
                    <!-- This is a dummy hidden field to trick firefox from auto filling the password -->
                    <input type="text" class="input-text no-display" name="dummy" id="dummy" />
                    <input type="password" class="input-text" name="current_password" id="current_password" />
                </div>
            </div>
        </li>
        <li class="fields">
            <div class="field">
                <label for="password"><?php echo $this->__('New Password') ?></label>
                <div class="input-box">
                    <input type="password" class="input-text validate-both-passwords validate-password" name="password" id="password" />
                </div>
            </div>
            <div class="field">
                <label for="confirmation"><?php echo $this->__('Confirm New Password') ?></label>
                <div class="input-box">
                    <input type="password" class="input-text validate-both-passwords" name="confirmation" id="confirmation" />
                </div>
            </div>
        </li>
    </ul>
</div>
<div class="buttons-set form-buttons">
    <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Go back') ?></a></p>
    <button type="submit" class="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Save')) ?>"><span><span><?php echo $this->__('Save') ?></span></span></button>
</div>
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
</form>
<script type="text/javascript">
//<![CDATA[
    var dataForm = new VarienForm('form-validate', true);
    function setPasswordForm(arg){
        if(arg){
            $('current_password').up(4).show();
            $('current_password').addClassName('required-entry');
            $('password').addClassName('required-entry');
            $('confirmation').addClassName('required-entry');

        }else{
            $('current_password').up(4).hide();
            $('current_password').removeClassName('required-entry');
            $('password').removeClassName('required-entry');
            $('confirmation').removeClassName('required-entry');
        }
    }
    <?php if($this->getCustomer()->getChangePassword()): ?>
        setPasswordForm(true);
    <?php endif; ?>
//]]>
</script>
